#!/bin/sh

# Log some extra information at the beginning of a suspend/resume cycle.

echo "!!! wifibt $1 $2 !!!" > /dev/kmsg

#wlan=$(ifconfig | grep wlp1s0)
hci=$(hciconfig | grep hci)

case "$1-$2" in
       pre-hibernate|pre-suspend)
                if [ ! -z "$hci" ]; then
                        hciconfig hci0 down
                fi
                #if [ ! -z "$wlan" ]; then
                #        ifconfig wlp1s0 down
                #fi
	       ;;
       post-hibernate|post-suspend)
                #if [ ! -z "$wlan" ]; then
                #        ifconfig wlp1s0 up
                #fi
                if [ ! -z "$hci" ]; then
                        hciconfig hci0 up
                fi
               ;;
       *) exit $NA
               ;;
esac
